package com.zhangyusheng.easyecharts.component;


import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.List;

/**
 * TODO: 系列
 *
 * @author Michael zhang
 * @email zhangys_0217@sina.com
 * @since 2025年11月03日
 */

@Data
@Accessors(chain = true)
public class Series implements Serializable {
    private final static long serialVersionUID = 2L;
    private String name;
    private String stack;
    private String type;
    private boolean smooth;
    /* 系列中的数据内容数组。数组项通常为具体的数据项。 */
    private List<Object> data;
    private AreaStyle areaStyle;
    private LineStyle lineStyle;
    private boolean showSymbol;
    private boolean showBackground;
    private BackgroundStyle backgroundStyle;
    private ItemStyle itemStyle;
    private Emphasis emphasis;
    private Label label;

    public static class Builder{
        private String name;
        private String stack;
        private String type;
        private boolean smooth;
        private List<Object> data;
        private AreaStyle areaStyle;
        private LineStyle lineStyle;
        private boolean showSymbol;
        private boolean showBackground;
        private BackgroundStyle backgroundStyle;
        private ItemStyle itemStyle;
        private Emphasis emphasis;
        private Label label;



        public Builder name(String name){
            this.name = name;
            return this;
        }
        public Builder stack(String stack){
            this.stack = stack;
            return this;
        }
        public Builder type(String type){
            this.type = type;
            return this;
        }
        public Builder smooth(boolean smooth){
            this.smooth = smooth;
            return this;
        }
        public Builder data(List<Object> data){
            this.data = data;
            return this;
        }
        public Builder areaStyle(AreaStyle areaStyle){
            this.areaStyle = areaStyle;
            return this;
        }
        public Builder lineStyle(LineStyle lineStyle){
            this.lineStyle = lineStyle;
            return this;
        }
        public Builder showSymbol(boolean showSymbol){
            this.showSymbol = showSymbol;
            return this;
        }
        public Builder showBackground(boolean showBackground){
            this.showBackground = showBackground;
            return this;
        }
        public Builder backgroundStyle(BackgroundStyle backgroundStyle){
            this.backgroundStyle = backgroundStyle;
            return this;
        }
        public Builder emphasis(Emphasis emphasis){
            this.emphasis = emphasis;
            return this;
        }
        public Builder itemStyle(ItemStyle itemStyle){
            this.itemStyle = itemStyle;
            return this;
        }
        public Builder label(Label label){
            this.label = label;
            return this;
        }

        public Series build(){
            return new Series(this);
        }
    }
    private Series(Builder builder){
        this.name = builder.name;
        this.stack = builder.stack;
        this.type = builder.type;
        this.data = builder.data;
        this.smooth = builder.smooth;
        this.areaStyle = builder.areaStyle;
        this.lineStyle = builder.lineStyle;
        this.showSymbol = builder.showSymbol;
        this.showBackground = builder.showBackground;
        this.backgroundStyle = builder.backgroundStyle;
        this.emphasis = builder.emphasis;
        this.itemStyle = builder.itemStyle;
        this.label = builder.label;
    }

}
